<template>
	<view class="dict_tag">
		<template v-for="(item, index) in options">
			
			<template v-if="values.includes(item.value)">
				<text v-if="item.listClass == 'default' || item.listClass == ''" :key="item.value" :index="index"
					>{{ item.label }}</text>
				<u-tag v-else :key="item.value" :index="index" :type="item.listClass ?  item.listClass:'primary' "
					 :text="item.label"></u-tag>
			</template>
		</template>
	</view>
</template>

<script>
	export default {
		name: "DictTag",
		props: {
			options: {
				type: Array,
				default: null,
			},
			value: [Number, String, Array],
		},
		computed: {
			values() {
				
				if (this.value !== null && typeof this.value !== 'undefined') {
					return Array.isArray(this.value) ? this.value : [String(this.value)];
				} else {
					return [];
				}
			},
		},
	};
</script>
<style scoped>
	.dict_tag text{
		font-size: 24rpx;
	}
	.el-tag+.el-tag {
		margin-left: 10px;
	}
</style>